#include<linux/module.h>
#include<linux/sched.h>
#include<linux/pid.h>
#include<linux/kernel.h>
#include<linux/kthread.h>
MODULE_LICENSE("GPL");
int my_function(void *argc)
{
	do_exit(0);
	printk("in the kernel thread function!\n");
	printk("the current pid is:%d\n",current->pid);
	printk("out the kernel thread function\n");
	return 0;
}
static int __init do_exit_init(void)
{
	struct task_struct *result;
	char namefrm[]="do_exit";
	printk("into do_exit_init.\n");
	result=kthread_create_on_node(my_function,NULL,-1,namefrm);
	wake_up_process(result);
	struct pid *kpid=find_get_pid(result->pid);

	printk("the pid of the find_get_pid is:%d\n",kpid->numbers[kpid->level].nr);

	printk("the pid of new thread is:%d\n",result->pid);
	printk("out do_exit_init.\n");
	return 0;
}
static void __exit do_exit_exit(void)
{
	printk("Goodbye do_exit\n");
}
module_init(do_exit_init);
module_exit(do_exit_exit);

